import axios from "axios";



// 设置请求地址
// axios.defaults.baseURL = ""
const instance = axios.create({
    baseURL: 'http://kumanxuan1.f3322.net:8001', //设置请求地址
    timeout: 5000 //超时时间
})

// 请求拦截器
instance.interceptors.request.use(config => {
    let token = localStorage.getItem("token")
    if (token) {
        config.headers.Authorization = token
        config.headers["X-Nideshop-Token"] = token
    }
    return config;
}, err => {
    return Promise.reject(err)
})

instance.interceptors.response.use(res => {
    return res.data;
}, err => {
    return Promise.reject(err)
})

export default instance